<template>
  <view
    class="top_bar"
    :style="{
      background: 'url(' + backgroundUrl + ')',
      'background-size': '100% 100%',
      'background-repeat': 'no-repeat',
    }"
  >
    <view style="height: var(--status-bar-height)"></view>
    <view class="bar">
      <image
        class="arrow"
        src="/static/img/components/ic_arrow_black.png"
        @click="backClick()"
      ></image>
    </view>
    <view class="title">{{ title }}</view>
  </view>
</template>

<script>
export default {
  name: "lawTopBar",
  props: {
    title: {
      type: String,
      default: "",
    },
    isBackClick: {
      type: Boolean,
      default: true,
    },
    backgroundUrl: {
      type: String,
      default: "",
    },
  },
  data() {
    return {
      arrowBlack: require("@/static/img/components/ic_arrow_black.png"),
    };
  },
  methods: {
    //点击返回
    backClick() {
      this.$emit("backClick");
      if (this.isBackClick)
        uni.navigateBack({
          delta: 1,
        });
    },
  },
};
</script>

<style lang="scss">
.top_bar {
  width: 100vw;
  position: relative;
  height: 320rpx;

  .bar {
    height: 80rpx;

    .arrow {
      position: absolute;
      top: calc(var(--status-bar-height) + 10rpx);
      left: 30rpx;
      width: 40rpx;
      height: 40rpx;
    }
  }

  .title {
    margin-top: 30rpx;
    padding-left: 30rpx;
    font-size: 50rpx;
    font-weight: 700;
    color: #333333;
    line-height: 40rpx;
  }
}
</style>
